using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace DacTaHinhThuc
{
    public partial class SettingFrm : Form
    {
        #region fields
        private string m_strColorKeyword;       //luu ten mau cua keyword
        private string m_strColorString;        //ten mau cua string
        private string m_strColorNameFunc;      //ten mau cua ten ham
        private string m_strColorComment;       //ten mau cua comment

        private string m_strCurrColor;          //mau nguoi dung dang chon
        #endregion

        #region properties
        public string ColorKeyword
        {
            get { return this.m_strColorKeyword; }
            set { this.m_strColorKeyword = value; }
        }
        public string ColorString
        {
            get { return this.m_strColorString; }
            set { this.m_strColorString = value; }
        }
        public string ColorNameFunc
        {
            get { return this.m_strColorNameFunc; }
            set { this.m_strColorNameFunc = value; }
        }
        public string ColorComment
        {
            get { return this.m_strColorComment; }
            set { this.m_strColorComment = value; }
        }
        #endregion

        public SettingFrm()
        {
            InitializeComponent();
        }

        private void SettingFrm_Load(object sender, EventArgs e)
        {
            picColorKeyword.BackColor = Color.FromName(this.m_strColorKeyword);
           
        }

        private void UpdateColor()
        {
            //update cac mau hien thi
            picColorKeyword.BackColor = Color.FromName(this.m_strCurrColor);
        }

        private void btnColorKeyword_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                //lay mau nguoi dung chon
                this.m_strCurrColor = colorDialog1.Color.Name;
                               

                UpdateColor();
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Ban co muon luu lai cac thay doi hay khong?", "Thong bao", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK)
            {
                this.m_strColorKeyword = this.m_strCurrColor;
                this.Close();
            }
        }
    }
}